import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'

// 导入elementPlus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 让日期控件为中文
import 'dayjs/locale/zh-cn';
import locale from 'element-plus/es/locale/lang/zh-cn';


// 引入初始化样式文件,自己创建可以是main.css,需要改掉
import '@/styles/common.scss'
import {imgLazyPlugin} from "@/directives/index.js";
import {componentPlugins} from "@/components/index.js";
const app = createApp(App)

//pinia和持久化插件
const pinia = createPinia();
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
pinia.use(piniaPluginPersistedstate)

app.use(pinia)
app.use(router).use(ElementPlus,{locale});

//引入懒加载插件并注册,这个方法一旦执行,就会执行里面的install方法，并把app传入进去
app.use(imgLazyPlugin);

//全局组件
app.use(componentPlugins);

app.mount('#app')
